<?php
include_once('db.php');
$userid = $_POST["userid"];
$sql = "select * from users where username = '".$userid["loginStatus"]."' and password = '".$userid["loginpassword"]."'";
//执行sql语句
// $row = mysqli_fetch_assoc($result); //查询第一条数据 指针指向第一个索引
// var_dump($row);
$result = mysqli_query($link,$sql);
// while($row = mysqli_fetch_assoc($result)){
//     $rows[] = $row;
// }
// echo "<pre>";
$rows = mysqli_fetch_all($result,MYSQLI_ASSOC);
if($rows!=[]&&$rows!=null&&$rows!=""&&$rows!=0){
	$newRow['status'] = 200; // 状态码
$newRow['msg'] = "请求成功"; //请求成功信息
$newRow['data'] = $rows;
echo json_encode($newRow);
}else{
	if($userid["loginStatus"]==""||$userid["loginpassword"]==""){
		$newRow['status'] = 505; // 状态码
		$newRow['msg'] = "无参数账号密码返回数据"; //请求成功信息
		$newRow['data'] = $rows;
		echo json_encode($newRow);
	}else{
		$newRow['status'] = 500; // 状态码
		$newRow['msg'] = "无返回数据"; //请求成功信息
		$newRow['data'] = $rows;
		echo json_encode($newRow);
	}
}
?>